﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using NotebookS2.Reports.Carousel;
using System.Data.SqlClient;
using Telerik.WinControls.UI;
using Telerik.Windows.Controls;
using NotebookS2.Sales.Logs;

namespace NotebookS2
{
    public partial class Carousel : DevExpress.XtraEditors.XtraForm
    {
        public Carousel()
        {
            InitializeComponent();
        }

        public string ConnectionString { get; set; }
        public MainMenu MainForm { get; set; }
        public double ProductNumber { get; set; }

        private void btnBewellC_Click(object sender, EventArgs e)
        {
            //ProductStats oForm = new ProductStats();
            //oForm.ConnectionString = this.ConnectionString;
            //oForm.MdiParent = this.MainForm;
            //oForm.Show();
        }

        private void Carousel_Load(object sender, EventArgs e)
        {
            //try
            //{
            //    SqlConnection oConnection = new SqlConnection();
            //    oConnection.ConnectionString = this.ConnectionString;
            //    oConnection.Open();

            //    SqlCommand oCommand = new SqlCommand("SELECT ROW_NUMBER()OVER (ORDER BY Description) AS Row, Description FROM ItemMaster WHERE IsActive <> 0 ORDER BY Description ASC", oConnection);
            //    SqlDataAdapter oAdapter = new SqlDataAdapter();
            //    DataTable dt = new DataTable();

            //    oAdapter.SelectCommand = oCommand;
            //    oAdapter.Fill(dt);

            //    int iRow = dt.Rows.Count;

            //    if (iRow > 0)
            //    {
            //        foreach (DataRow oRow in dt.Rows)
            //        {
            //            string itemss = oRow["Description"].ToString();
            //            radCarousel1.Items.Add((new RadButtonElement(itemss)));
            //        }

            //        oCommand.Dispose();
            //        oConnection.Close();
            //    }
            //    else
            //    {
            //        MessageBox.Show("No product found!", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        oCommand.Dispose();
            //        oConnection.Close();
            //    }


              
            //}
            //catch
            //{
            //}

            
        }

        private void radCarousel1_Click(object sender, EventArgs e)
        {
            
        }

        private void radCarousel1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }

        private void radCarousel1_DoubleClick(object sender, EventArgs e)
        {
            //string carouselItem = radCarousel1.SelectedItem.ToString();

            //if (carouselItem != null)
            //{
            //    ProductNumber = radCarousel1.SelectedIndex + 1;
            //    ProductStats oForm = new ProductStats();
            //    oForm.ConnectionString = this.ConnectionString;
            //    oForm.ProductCode = this.ProductNumber;
            //    oForm.MdiParent = this.MainForm;
            //    oForm.Show();
            //}
            //else
            //{
            //    return;
            //}

        }

        private void radProductMovement_Click(object sender, EventArgs e)
        {
            ProductMovement oForm = new ProductMovement();
            oForm.MdiParent = this.MainForm;
            oForm.ConnectionString = this.ConnectionString;
            oForm.Show();
        }

        private void radProductMovement_DoubleClick(object sender, EventArgs e)
        {
           
        }


    }
}